/**
 * SpringPropertiesUtil.java	  V1.0   2014-4-10 上午10:30:47
 *
 * Copyright GTA Information System Co. ,Ltd. All rights reserved.
 *
 * Modification history(By    Time    Reason):
 * 
 * Description:
 */

package com.front.common;

import java.util.HashMap;
import java.util.Map;

 
 
public class AppPropertiesUtil {

	
	private static Map<String,String> properties=new HashMap<String, String>();
	
	public static void putProperties(Map<String,String> src){
		properties.putAll(src);
	}
	
	public static void clearProperties(){
		properties.clear();
	}
	
    /**
     * 获取配置文件中的内容
     *
     * @param keyName
     * @return
     */
    public static String getStringValue(String keyName) {
    	String  str = StringUtils.obj2String(properties.get(keyName));
        return str;
    }
 
    
    /**
     * 获取配置文件中的内容
     *
     * @param keyName
     * @return
     */
    public static String getStringValue(String keyName,String defaultValue) {
    	String  str = StringUtils.obj2String(properties.get(keyName));
    	if(StringUtils.isBlank(str))
    	{
    		return defaultValue;
    	}
        return str;
    }
    
    
    /**
     * 获取配置文件中的内容
     *
     * @param keyName
     * @return
     */
    public static int getIntValue(String keyName) {
    	int  ret = StringUtils.str2Int(properties.get(keyName));
        return ret;
    }
 
 
}
